package com.gzh.redis_to_mq.producer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * @Description TODO
 * @Author gzh
 * @Date 2020/10/26 13:28
 */
@Component
public class Publisher {

    @Qualifier("redisTemplate1")
    @Autowired
    private RedisTemplate redis;


    public void publish(Object msg){

        System.out.println("Publisher");

        redis.convertAndSend("demo-channel",msg);

    }

}
